{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 下载和缓存数据集"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在整本书中，我们将下载不同的数据集，并训练和测试模型。这里我们实现几个函数来方便下载数据。首先，\n",
    "我们建立字典DATA_HUB，它可以将数据集名称的字符串映射到数据集相关的二元组上，这个二元组包含数据\n",
    "集的url和验证文件完整性的sha‐1密钥。</br>所有类似的数据集都托管在地址为DATA_URL的站点上"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import hashlib\n",
    "import os\n",
    "import tarfile\n",
    "import zipfile\n",
    "import requests\n",
    "#@save\n",
    "DATA_HUB = dict()\n",
    "DATA_URL = 'http://d2l-data.s3-accelerate.amazonaws.com/'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**下载函数**\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面的download函数用来下载数据集，将数据集缓存在本地目录（默认情况下为./data）中，并返回下载文\n",
    "件的名称。</br>如果缓存目录中已经存在此数据集文件，并且其sha‐1与存储在DATA_HUB中的相匹配，</br>我们将使用\n",
    "缓存的文件，以避免重复的下载。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def download(name, cache_dir=os.path.join('.', 'data')):  # @save\n",
    "    \"\"\"下载一个DATA_HUB中的文件，返回本地文件名\"\"\"\n",
    "    assert name in DATA_HUB, f\"{name} 不存在于 {DATA_HUB}\"\n",
    "    url, sha1_hash = DATA_HUB[name]\n",
    "    os.makedirs(cache_dir, exist_ok=True)\n",
    "    fname = os.path.join(cache_dir, url.split('/')[-1])\n",
    "    \n",
    "    if os.path.exists(fname):\n",
    "        sha1 = hashlib.sha1()\n",
    "        with open(fname, 'rb') as f:\n",
    "            while True:\n",
    "                data = f.read(1048576)  # 每次读取1MB的数据\n",
    "                if not data:\n",
    "                    break\n",
    "                sha1.update(data)\n",
    "        if sha1.hexdigest() == sha1_hash:\n",
    "            return fname  # 命中缓存\n",
    "    \n",
    "    print(f'正在从{url}下载{fname}...')\n",
    "    r = requests.get(url, stream=True, verify=True)\n",
    "    with open(fname, 'wb') as f:\n",
    "        f.write(r.content)\n",
    "    \n",
    "    return fname\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**两个函数**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "一个将下载并解压缩一个zip或tar文件，</br>另一个是将本书中使用的所有数据集\n",
    "从DATA_HUB下载到缓存目录中。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "def download_extract(name, folder=None):  # @save\n",
    "    \"\"\"下载并解压zip/tar文件\"\"\"\n",
    "    fname = download(name)  # 下载文件\n",
    "    base_dir = os.path.dirname(fname)  # 获取文件所在目录\n",
    "    data_dir, ext = os.path.splitext(fname)  # 分离文件名和扩展名\n",
    "\n",
    "    if ext == '.zip':\n",
    "        fp = zipfile.ZipFile(fname, 'r')  # 打开zip文件\n",
    "    elif ext in ('.tar', '.gz'):\n",
    "        fp = tarfile.open(fname, 'r')  # 打开tar文件\n",
    "    else:\n",
    "        assert False, '只有zip/tar文件可以被解压缩'  # 只支持zip和tar格式\n",
    "\n",
    "    fp.extractall(base_dir)  # 解压到指定目录\n",
    "    return os.path.join(base_dir, folder) if folder else data_dir  # 返回解压后的目录\n",
    "\n",
    "def download_all():  # @save\n",
    "    \"\"\"下载DATA_HUB中的所有文件\"\"\"\n",
    "    for name in DATA_HUB:\n",
    "        download(name)  # 下载每个文件\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 房价数据下载与预处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import torch\n",
    "from torch import nn\n",
    "from d2l import torch as d2l"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "DATA_HUB['kaggle_house_train'] = ( #@save\n",
    "DATA_URL + 'kaggle_house_pred_train.csv',\n",
    "'585e9cc93e70b39160e7921475f9bcd7d31219ce')\n",
    "DATA_HUB['kaggle_house_test'] = ( #@save\n",
    "DATA_URL + 'kaggle_house_pred_test.csv',\n",
    "'fa19780a7b011d9b009e8bff8e99922a8ee2eb90')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "#读取文件\n",
    "train_data=pd.read_csv(download('kaggle_house_train'))\n",
    "test_data=pd.read_csv(download('kaggle_house_test'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "      <th>MSSubClass</th>\n",
       "      <th>MSZoning</th>\n",
       "      <th>LotFrontage</th>\n",
       "      <th>LotArea</th>\n",
       "      <th>Street</th>\n",
       "      <th>Alley</th>\n",
       "      <th>LotShape</th>\n",
       "      <th>LandContour</th>\n",
       "      <th>Utilities</th>\n",
       "      <th>...</th>\n",
       "      <th>PoolArea</th>\n",
       "      <th>PoolQC</th>\n",
       "      <th>Fence</th>\n",
       "      <th>MiscFeature</th>\n",
       "      <th>MiscVal</th>\n",
       "      <th>MoSold</th>\n",
       "      <th>YrSold</th>\n",
       "      <th>SaleType</th>\n",
       "      <th>SaleCondition</th>\n",
       "      <th>SalePrice</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>60</td>\n",
       "      <td>RL</td>\n",
       "      <td>65.0</td>\n",
       "      <td>8450</td>\n",
       "      <td>Pave</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Reg</td>\n",
       "      <td>Lvl</td>\n",
       "      <td>AllPub</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2008</td>\n",
       "      <td>WD</td>\n",
       "      <td>Normal</td>\n",
       "      <td>208500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>20</td>\n",
       "      <td>RL</td>\n",
       "      <td>80.0</td>\n",
       "      <td>9600</td>\n",
       "      <td>Pave</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Reg</td>\n",
       "      <td>Lvl</td>\n",
       "      <td>AllPub</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>2007</td>\n",
       "      <td>WD</td>\n",
       "      <td>Normal</td>\n",
       "      <td>181500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>60</td>\n",
       "      <td>RL</td>\n",
       "      <td>68.0</td>\n",
       "      <td>11250</td>\n",
       "      <td>Pave</td>\n",
       "      <td>NaN</td>\n",
       "      <td>IR1</td>\n",
       "      <td>Lvl</td>\n",
       "      <td>AllPub</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>2008</td>\n",
       "      <td>WD</td>\n",
       "      <td>Normal</td>\n",
       "      <td>223500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>70</td>\n",
       "      <td>RL</td>\n",
       "      <td>60.0</td>\n",
       "      <td>9550</td>\n",
       "      <td>Pave</td>\n",
       "      <td>NaN</td>\n",
       "      <td>IR1</td>\n",
       "      <td>Lvl</td>\n",
       "      <td>AllPub</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2006</td>\n",
       "      <td>WD</td>\n",
       "      <td>Abnorml</td>\n",
       "      <td>140000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>60</td>\n",
       "      <td>RL</td>\n",
       "      <td>84.0</td>\n",
       "      <td>14260</td>\n",
       "      <td>Pave</td>\n",
       "      <td>NaN</td>\n",
       "      <td>IR1</td>\n",
       "      <td>Lvl</td>\n",
       "      <td>AllPub</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "      <td>2008</td>\n",
       "      <td>WD</td>\n",
       "      <td>Normal</td>\n",
       "      <td>250000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 81 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   Id  MSSubClass MSZoning  LotFrontage  LotArea Street Alley LotShape  \\\n",
       "0   1          60       RL         65.0     8450   Pave   NaN      Reg   \n",
       "1   2          20       RL         80.0     9600   Pave   NaN      Reg   \n",
       "2   3          60       RL         68.0    11250   Pave   NaN      IR1   \n",
       "3   4          70       RL         60.0     9550   Pave   NaN      IR1   \n",
       "4   5          60       RL         84.0    14260   Pave   NaN      IR1   \n",
       "\n",
       "  LandContour Utilities  ... PoolArea PoolQC Fence MiscFeature MiscVal MoSold  \\\n",
       "0         Lvl    AllPub  ...        0    NaN   NaN         NaN       0      2   \n",
       "1         Lvl    AllPub  ...        0    NaN   NaN         NaN       0      5   \n",
       "2         Lvl    AllPub  ...        0    NaN   NaN         NaN       0      9   \n",
       "3         Lvl    AllPub  ...        0    NaN   NaN         NaN       0      2   \n",
       "4         Lvl    AllPub  ...        0    NaN   NaN         NaN       0     12   \n",
       "\n",
       "  YrSold  SaleType  SaleCondition  SalePrice  \n",
       "0   2008        WD         Normal     208500  \n",
       "1   2007        WD         Normal     181500  \n",
       "2   2008        WD         Normal     223500  \n",
       "3   2006        WD        Abnorml     140000  \n",
       "4   2008        WD         Normal     250000  \n",
       "\n",
       "[5 rows x 81 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "训练数据集包括1460个样本，每个样本80个特征和1个标签，而测试数据集包含1459个样本，每个样本80个特\n",
    "征。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1460, 81)\n",
      "(1459, 80)\n"
     ]
    }
   ],
   "source": [
    "print(train_data.shape)\n",
    "print(test_data.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "查看前四条数据的，前四个与后两个特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "      <th>MSSubClass</th>\n",
       "      <th>MSZoning</th>\n",
       "      <th>LotFrontage</th>\n",
       "      <th>SalePrice</th>\n",
       "      <th>SaleCondition</th>\n",
       "      <th>SaleType</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>60</td>\n",
       "      <td>RL</td>\n",
       "      <td>65.0</td>\n",
       "      <td>208500</td>\n",
       "      <td>Normal</td>\n",
       "      <td>WD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>20</td>\n",
       "      <td>RL</td>\n",
       "      <td>80.0</td>\n",
       "      <td>181500</td>\n",
       "      <td>Normal</td>\n",
       "      <td>WD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>60</td>\n",
       "      <td>RL</td>\n",
       "      <td>68.0</td>\n",
       "      <td>223500</td>\n",
       "      <td>Normal</td>\n",
       "      <td>WD</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>70</td>\n",
       "      <td>RL</td>\n",
       "      <td>60.0</td>\n",
       "      <td>140000</td>\n",
       "      <td>Abnorml</td>\n",
       "      <td>WD</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Id  MSSubClass MSZoning  LotFrontage  SalePrice SaleCondition SaleType\n",
       "0   1          60       RL         65.0     208500        Normal       WD\n",
       "1   2          20       RL         80.0     181500        Normal       WD\n",
       "2   3          60       RL         68.0     223500        Normal       WD\n",
       "3   4          70       RL         60.0     140000       Abnorml       WD"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看特征\n",
    "train_data.iloc[0:4,[0,1,2,3,-1,-2,-3]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2919, 79)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# \"\"\"id作为特征没有用，删掉\"\"\"\n",
    "\"\"\"训练集里1：-1指的是第二列到倒数第二列,因为测试集没有售价\"\"\"\n",
    "all_features = pd.concat((train_data.iloc[:, 1:-1], test_data.iloc[:, 1:]))\n",
    "all_features.shape#合并了训练集和测试集去掉ID的其他特征"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 数据处理"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "0均值，单位方差标准化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MSSubClass         int64\n",
       "MSZoning          object\n",
       "LotFrontage      float64\n",
       "LotArea            int64\n",
       "Street            object\n",
       "                  ...   \n",
       "MiscVal            int64\n",
       "MoSold             int64\n",
       "YrSold             int64\n",
       "SaleType          object\n",
       "SaleCondition     object\n",
       "Length: 79, dtype: object"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_features.dtypes#dtypes是object包含文字、地址等信息"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**均值方差标准化**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2919, 79)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\"获取数字类型的特征的索引\"\"\"\n",
    "numeric_features=all_features.dtypes[all_features.dtypes!='object'].index\n",
    "#将所有涉及数字的特征进行均值方差标准化\n",
    "all_features[numeric_features]=all_features[numeric_features].apply(lambda x:(x-x.mean())/(x.std()))\n",
    "#填补缺失值为0\n",
    "all_features[numeric_features]=all_features[numeric_features].fillna(0)\n",
    "all_features.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**使用独热编码处理离散值：object**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "例如，“MSZoning”包含值“RL”和“Rm”。我\n",
    "们将创建两个新的指示器特征“MSZoning_RL”和“MSZoning_RM”，其值为0或1。</br>根据独热编码，如果\n",
    "“MSZoning”的原始值为“RL”，则：“MSZoning_RL”为1，“MSZoning_RM”为0。</br>pandas软件包会自动为\n",
    "我们实现这一点。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2919, 330)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_features=pd.get_dummies(all_features,dummy_na=True,dtype=int)#空缺值NAN，也算入一个有效值,将TURE or FALSE转为 0 1\n",
    "all_features.shape#从79扩充到330个特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>MSSubClass</th>\n",
       "      <th>LotFrontage</th>\n",
       "      <th>LotArea</th>\n",
       "      <th>OverallQual</th>\n",
       "      <th>OverallCond</th>\n",
       "      <th>YearBuilt</th>\n",
       "      <th>YearRemodAdd</th>\n",
       "      <th>MasVnrArea</th>\n",
       "      <th>BsmtFinSF1</th>\n",
       "      <th>BsmtFinSF2</th>\n",
       "      <th>...</th>\n",
       "      <th>SaleType_Oth</th>\n",
       "      <th>SaleType_WD</th>\n",
       "      <th>SaleType_nan</th>\n",
       "      <th>SaleCondition_Abnorml</th>\n",
       "      <th>SaleCondition_AdjLand</th>\n",
       "      <th>SaleCondition_Alloca</th>\n",
       "      <th>SaleCondition_Family</th>\n",
       "      <th>SaleCondition_Normal</th>\n",
       "      <th>SaleCondition_Partial</th>\n",
       "      <th>SaleCondition_nan</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.067320</td>\n",
       "      <td>-0.184443</td>\n",
       "      <td>-0.217841</td>\n",
       "      <td>0.646073</td>\n",
       "      <td>-0.507197</td>\n",
       "      <td>1.046078</td>\n",
       "      <td>0.896679</td>\n",
       "      <td>0.523038</td>\n",
       "      <td>0.580708</td>\n",
       "      <td>-0.29303</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.873466</td>\n",
       "      <td>0.458096</td>\n",
       "      <td>-0.072032</td>\n",
       "      <td>-0.063174</td>\n",
       "      <td>2.187904</td>\n",
       "      <td>0.154737</td>\n",
       "      <td>-0.395536</td>\n",
       "      <td>-0.569893</td>\n",
       "      <td>1.177709</td>\n",
       "      <td>-0.29303</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.067320</td>\n",
       "      <td>-0.055935</td>\n",
       "      <td>0.137173</td>\n",
       "      <td>0.646073</td>\n",
       "      <td>-0.507197</td>\n",
       "      <td>0.980053</td>\n",
       "      <td>0.848819</td>\n",
       "      <td>0.333448</td>\n",
       "      <td>0.097840</td>\n",
       "      <td>-0.29303</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.302516</td>\n",
       "      <td>-0.398622</td>\n",
       "      <td>-0.078371</td>\n",
       "      <td>0.646073</td>\n",
       "      <td>-0.507197</td>\n",
       "      <td>-1.859033</td>\n",
       "      <td>-0.682695</td>\n",
       "      <td>-0.569893</td>\n",
       "      <td>-0.494771</td>\n",
       "      <td>-0.29303</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.067320</td>\n",
       "      <td>0.629439</td>\n",
       "      <td>0.518814</td>\n",
       "      <td>1.355319</td>\n",
       "      <td>-0.507197</td>\n",
       "      <td>0.947040</td>\n",
       "      <td>0.753100</td>\n",
       "      <td>1.381770</td>\n",
       "      <td>0.468770</td>\n",
       "      <td>-0.29303</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 330 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   MSSubClass  LotFrontage   LotArea  OverallQual  OverallCond  YearBuilt  \\\n",
       "0    0.067320    -0.184443 -0.217841     0.646073    -0.507197   1.046078   \n",
       "1   -0.873466     0.458096 -0.072032    -0.063174     2.187904   0.154737   \n",
       "2    0.067320    -0.055935  0.137173     0.646073    -0.507197   0.980053   \n",
       "3    0.302516    -0.398622 -0.078371     0.646073    -0.507197  -1.859033   \n",
       "4    0.067320     0.629439  0.518814     1.355319    -0.507197   0.947040   \n",
       "\n",
       "   YearRemodAdd  MasVnrArea  BsmtFinSF1  BsmtFinSF2  ...  SaleType_Oth  \\\n",
       "0      0.896679    0.523038    0.580708    -0.29303  ...             0   \n",
       "1     -0.395536   -0.569893    1.177709    -0.29303  ...             0   \n",
       "2      0.848819    0.333448    0.097840    -0.29303  ...             0   \n",
       "3     -0.682695   -0.569893   -0.494771    -0.29303  ...             0   \n",
       "4      0.753100    1.381770    0.468770    -0.29303  ...             0   \n",
       "\n",
       "   SaleType_WD  SaleType_nan  SaleCondition_Abnorml  SaleCondition_AdjLand  \\\n",
       "0            1             0                      0                      0   \n",
       "1            1             0                      0                      0   \n",
       "2            1             0                      0                      0   \n",
       "3            1             0                      1                      0   \n",
       "4            1             0                      0                      0   \n",
       "\n",
       "   SaleCondition_Alloca  SaleCondition_Family  SaleCondition_Normal  \\\n",
       "0                     0                     0                     1   \n",
       "1                     0                     0                     1   \n",
       "2                     0                     0                     1   \n",
       "3                     0                     0                     0   \n",
       "4                     0                     0                     1   \n",
       "\n",
       "   SaleCondition_Partial  SaleCondition_nan  \n",
       "0                      0                  0  \n",
       "1                      0                  0  \n",
       "2                      0                  0  \n",
       "3                      0                  0  \n",
       "4                      0                  0  \n",
       "\n",
       "[5 rows x 330 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_features.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**数据转换**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "n_train=train_data.shape[0]\n",
    "#训练集X\n",
    "train_features=torch.tensor(all_features[:n_train].values,dtype=torch.float32)\n",
    "#测试集X\n",
    "test_features=torch.tensor(all_features[n_train:].values,dtype=torch.float32)\n",
    "#训练集Y\n",
    "train_labels=torch.tensor(train_data.SalePrice.values.reshape(-1,1),dtype=torch.float32)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "训练集的X数量和Y能对的上，可喜可贺可喜可贺"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([1460, 330])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_features.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([1460, 1])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_labels.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 训练"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "训练集特征数量： 330\n"
     ]
    }
   ],
   "source": [
    "loss=nn.MSELoss()\n",
    "num_features=train_features.shape[1]\n",
    "print(\"训练集特征数量：\",num_features)\n",
    "#多层感知机\n",
    "def get_net():\n",
    "    net=nn.Sequential(\n",
    "                      nn.Flatten(),\n",
    "                      nn.Linear(num_features,256),nn.ReLU(),\n",
    "                      nn.Linear(256,128),nn.ReLU(),\n",
    "                      nn.Linear(128,1)\n",
    "                      \n",
    "                      )\n",
    "    return net\n",
    "# def get_net():\n",
    "#     net=nn.Sequential(\n",
    "#         nn.Flatten(),\n",
    "#         nn.Linear(num_features,64),nn.ReLU(),\n",
    "#         nn.Linear(64,1)\n",
    "#     )\n",
    "#     return net"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**关注预测值和真实值的相对差异而非绝对差异**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![alt text](image20250116.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在乎的是相对差异，就是房价别差那么离谱，</br>比如12万差10万-不好</br>400万差10万-good!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "def log_rmse(net,features,labels):\n",
    "    #设置传入值，最小是1，最大正无穷\n",
    "    \"\"\"目的：保证传入对数的X符合大于等于1\"\"\"\n",
    "    clipped_preds=torch.clamp(net(features),1,float('inf'))\n",
    "    rmse=torch.sqrt(loss(torch.log(clipped_preds),torch.log(labels)))\n",
    "    return rmse.item()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "#使用Adam训练器\n",
    "def train(net,train_features,train_labels,test_features,test_labels,#其实也是验证集\n",
    "          num_epochs,learning_rate,weight_decay,batch_size):\n",
    "      train_ls=[]\n",
    "      test_ls=[]\n",
    "      train_iter=d2l.load_array((train_features,train_labels),batch_size=batch_size)\n",
    "    #优化器：adam\n",
    "      optimizer=torch.optim.Adam(net.parameters()\n",
    "                               ,lr=learning_rate\n",
    "                               ,weight_decay=weight_decay)\n",
    "      for epoch in range(num_epochs):\n",
    "            for X,y in train_iter:\n",
    "                  optimizer.zero_grad()\n",
    "                  l=loss(net(X),y)\n",
    "                  l.backward()\n",
    "                  optimizer.step()\n",
    "            train_ls.append(log_rmse(net,train_features,train_labels))\n",
    "            if test_labels is not None:#传入验证集的话,累加验证集的损失函数\n",
    "                  test_ls.append(log_rmse(net,test_features,test_labels))\n",
    "      return train_ls,test_ls\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**K折交叉验证：判断模型性能&泛化能力**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "具体地说，它选择第i个切片作为验证数据，其余\n",
    "部分作为训练数据。</br>注意，这并不是处理数据的最有效方法，如果我们的数据集大得多，会有其他解决办法。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"实现K折交叉验证中的数据划分\"\"\"\n",
    "def get_k_fold_data(k,i,x,y):\n",
    "    assert k>1#确保K大于1\n",
    "    fold_size=x.shape[0]\n",
    "    fold_size=x.shape[0]//k#计算每个折的大小\n",
    "    x_train,y_train=None,None#初始化训练集\n",
    "    for j in range(k):\n",
    "        idx=slice(j*fold_size,(j+1)*fold_size)#计算当前折的索引\n",
    "        x_part,y_part=x[idx,:],y[idx]#提取当前折的特征与标签\n",
    "        if j==i:#如果当前折是指定的验证折，将其赋值给x_valid,y_valid\n",
    "            x_valid,y_valid=x_part,y_part\n",
    "        elif x_train is None:#若训练集没有初始化，赋值给ta\n",
    "            x_train,y_train=x_part,y_part\n",
    "        else:#若是已经初始化，则合并进入训练集\n",
    "            x_train=torch.cat([x_train,x_part],0)\n",
    "            y_train=torch.cat([y_train,y_part],0)\n",
    "    return x_train,y_train,x_valid,y_valid\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在K折交叉验证中训练K次后，返回训练和验证误差的平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "def k_fold(k,x_train,y_train,num_epochs,\n",
    "           learning_rate,weight_decay,batch_size):\n",
    "    train_l_sum,valid_l_sum=0,0#初始化训练损失和验证损失的总和，后续计算平均损失\n",
    "    for i in range(k):#遍历每个折的索引\n",
    "        data=get_k_fold_data(k,i,x_train,y_train)\n",
    "        net=get_net()\n",
    "        train_ls,valid_ls=train(net,*data,num_epochs,learning_rate=learning_rate,\n",
    "                                weight_decay=weight_decay,\n",
    "                                batch_size=batch_size\n",
    "                                )\n",
    "        #将最新的训练损失累加到总和中\n",
    "        train_l_sum+=train_ls[-1]\n",
    "        valid_l_sum+=valid_ls[-1]\n",
    "        \"\"\"\n",
    "        仅在第一个折时绘制训练和验证损失的曲线。使用 d2l.plot 函数绘制损失曲线，\n",
    "        横轴为训练轮数，纵轴为 RMSE（均方根误差），并设置对数坐标轴。\n",
    "        \"\"\"\n",
    "        if i == 0:\n",
    "            d2l.plot(list(range(1, num_epochs + 1)), [train_ls, valid_ls],\n",
    "             xlabel='epoch', ylabel='rmse', xlim=[1, num_epochs],\n",
    "             legend=['train', 'valid'], yscale='log')\n",
    "        \n",
    "        print(f'折{i + 1}，训练log rmse{float(train_ls[-1]):f}, '\n",
    "      f'验证log rmse{float(valid_ls[-1]):f}')\n",
    "    return train_l_sum/k,valid_l_sum/k#返回所有折的平均训练&验证损失\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "模型选择：一组待调优的超参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "折1，训练log rmse0.090740, 验证log rmse0.152938\n",
      "折2，训练log rmse0.027198, 验证log rmse0.165077\n",
      "折3，训练log rmse0.008284, 验证log rmse0.147495\n",
      "折4，训练log rmse0.008520, 验证log rmse0.134610\n",
      "折5，训练log rmse0.018836, 验证log rmse0.167513\n",
      "5-折验证：平均训练log mse0.030715414322912693,验证log rmse0.15352649092674256\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"263.421875pt\" height=\"183.35625pt\" viewBox=\"0 0 263.421875 183.35625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2025-01-16T13:28:19.529103</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 183.35625 \n",
       "L 263.421875 183.35625 \n",
       "L 263.421875 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 51.378125 145.8 \n",
       "L 246.678125 145.8 \n",
       "L 246.678125 7.2 \n",
       "L 51.378125 7.2 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 99.83602 145.8 \n",
       "L 99.83602 7.2 \n",
       "\" clip-path=\"url(#pa52aeb5848)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\">\n",
       "      <defs>\n",
       "       <path id=\"mbffa62a891\" d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbffa62a891\" x=\"99.83602\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- 100 -->\n",
       "      <g transform=\"translate(90.29227 160.398438) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 148.783388 145.8 \n",
       "L 148.783388 7.2 \n",
       "\" clip-path=\"url(#pa52aeb5848)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbffa62a891\" x=\"148.783388\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- 200 -->\n",
       "      <g transform=\"translate(139.239638 160.398438) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 197.730757 145.8 \n",
       "L 197.730757 7.2 \n",
       "\" clip-path=\"url(#pa52aeb5848)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbffa62a891\" x=\"197.730757\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 300 -->\n",
       "      <g transform=\"translate(188.187007 160.398438) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \n",
       "Q 3050 2419 3304 2112 \n",
       "Q 3559 1806 3559 1356 \n",
       "Q 3559 666 3084 287 \n",
       "Q 2609 -91 1734 -91 \n",
       "Q 1441 -91 1130 -33 \n",
       "Q 819 25 488 141 \n",
       "L 488 750 \n",
       "Q 750 597 1062 519 \n",
       "Q 1375 441 1716 441 \n",
       "Q 2309 441 2620 675 \n",
       "Q 2931 909 2931 1356 \n",
       "Q 2931 1769 2642 2001 \n",
       "Q 2353 2234 1838 2234 \n",
       "L 1294 2234 \n",
       "L 1294 2753 \n",
       "L 1863 2753 \n",
       "Q 2328 2753 2575 2939 \n",
       "Q 2822 3125 2822 3475 \n",
       "Q 2822 3834 2567 4026 \n",
       "Q 2313 4219 1838 4219 \n",
       "Q 1578 4219 1281 4162 \n",
       "Q 984 4106 628 3988 \n",
       "L 628 4550 \n",
       "Q 988 4650 1302 4700 \n",
       "Q 1616 4750 1894 4750 \n",
       "Q 2613 4750 3031 4423 \n",
       "Q 3450 4097 3450 3541 \n",
       "Q 3450 3153 3228 2886 \n",
       "Q 3006 2619 2597 2516 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-33\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 246.678125 145.8 \n",
       "L 246.678125 7.2 \n",
       "\" clip-path=\"url(#pa52aeb5848)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbffa62a891\" x=\"246.678125\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- 400 -->\n",
       "      <g transform=\"translate(237.134375 160.398438) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
       "L 825 1625 \n",
       "L 2419 1625 \n",
       "L 2419 4116 \n",
       "z\n",
       "M 2253 4666 \n",
       "L 3047 4666 \n",
       "L 3047 1625 \n",
       "L 3713 1625 \n",
       "L 3713 1100 \n",
       "L 3047 1100 \n",
       "L 3047 0 \n",
       "L 2419 0 \n",
       "L 2419 1100 \n",
       "L 313 1100 \n",
       "L 313 1709 \n",
       "L 2253 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-34\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_5\">\n",
       "     <!-- epoch -->\n",
       "     <g transform=\"translate(133.8 174.076563) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \n",
       "L 3597 1613 \n",
       "L 953 1613 \n",
       "Q 991 1019 1311 708 \n",
       "Q 1631 397 2203 397 \n",
       "Q 2534 397 2845 478 \n",
       "Q 3156 559 3463 722 \n",
       "L 3463 178 \n",
       "Q 3153 47 2828 -22 \n",
       "Q 2503 -91 2169 -91 \n",
       "Q 1331 -91 842 396 \n",
       "Q 353 884 353 1716 \n",
       "Q 353 2575 817 3079 \n",
       "Q 1281 3584 2069 3584 \n",
       "Q 2775 3584 3186 3129 \n",
       "Q 3597 2675 3597 1894 \n",
       "z\n",
       "M 3022 2063 \n",
       "Q 3016 2534 2758 2815 \n",
       "Q 2500 3097 2075 3097 \n",
       "Q 1594 3097 1305 2825 \n",
       "Q 1016 2553 972 2059 \n",
       "L 3022 2063 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \n",
       "L 1159 -1331 \n",
       "L 581 -1331 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2969 \n",
       "Q 1341 3281 1617 3432 \n",
       "Q 1894 3584 2278 3584 \n",
       "Q 2916 3584 3314 3078 \n",
       "Q 3713 2572 3713 1747 \n",
       "Q 3713 922 3314 415 \n",
       "Q 2916 -91 2278 -91 \n",
       "Q 1894 -91 1617 61 \n",
       "Q 1341 213 1159 525 \n",
       "z\n",
       "M 3116 1747 \n",
       "Q 3116 2381 2855 2742 \n",
       "Q 2594 3103 2138 3103 \n",
       "Q 1681 3103 1420 2742 \n",
       "Q 1159 2381 1159 1747 \n",
       "Q 1159 1113 1420 752 \n",
       "Q 1681 391 2138 391 \n",
       "Q 2594 391 2855 752 \n",
       "Q 3116 1113 3116 1747 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \n",
       "Q 1497 3097 1228 2736 \n",
       "Q 959 2375 959 1747 \n",
       "Q 959 1119 1226 758 \n",
       "Q 1494 397 1959 397 \n",
       "Q 2419 397 2687 759 \n",
       "Q 2956 1122 2956 1747 \n",
       "Q 2956 2369 2687 2733 \n",
       "Q 2419 3097 1959 3097 \n",
       "z\n",
       "M 1959 3584 \n",
       "Q 2709 3584 3137 3096 \n",
       "Q 3566 2609 3566 1747 \n",
       "Q 3566 888 3137 398 \n",
       "Q 2709 -91 1959 -91 \n",
       "Q 1206 -91 779 398 \n",
       "Q 353 888 353 1747 \n",
       "Q 353 2609 779 3096 \n",
       "Q 1206 3584 1959 3584 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \n",
       "L 3122 2828 \n",
       "Q 2878 2963 2633 3030 \n",
       "Q 2388 3097 2138 3097 \n",
       "Q 1578 3097 1268 2742 \n",
       "Q 959 2388 959 1747 \n",
       "Q 959 1106 1268 751 \n",
       "Q 1578 397 2138 397 \n",
       "Q 2388 397 2633 464 \n",
       "Q 2878 531 3122 666 \n",
       "L 3122 134 \n",
       "Q 2881 22 2623 -34 \n",
       "Q 2366 -91 2075 -91 \n",
       "Q 1284 -91 818 406 \n",
       "Q 353 903 353 1747 \n",
       "Q 353 2603 823 3093 \n",
       "Q 1294 3584 2113 3584 \n",
       "Q 2378 3584 2631 3529 \n",
       "Q 2884 3475 3122 3366 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \n",
       "L 3513 0 \n",
       "L 2938 0 \n",
       "L 2938 2094 \n",
       "Q 2938 2591 2744 2837 \n",
       "Q 2550 3084 2163 3084 \n",
       "Q 1697 3084 1428 2787 \n",
       "Q 1159 2491 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 4863 \n",
       "L 1159 4863 \n",
       "L 1159 2956 \n",
       "Q 1366 3272 1645 3428 \n",
       "Q 1925 3584 2291 3584 \n",
       "Q 2894 3584 3203 3211 \n",
       "Q 3513 2838 3513 2113 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-65\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-70\" x=\"61.523438\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"125\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-63\" x=\"186.181641\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-68\" x=\"241.162109\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 51.378125 137.777228 \n",
       "L 246.678125 137.777228 \n",
       "\" clip-path=\"url(#pa52aeb5848)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <defs>\n",
       "       <path id=\"mf6ab7cfe02\" d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6ab7cfe02\" x=\"51.378125\" y=\"137.777228\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- $\\mathdefault{10^{-2}}$ -->\n",
       "      <g transform=\"translate(20.878125 141.576447) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \n",
       "L 4684 2272 \n",
       "L 4684 1741 \n",
       "L 678 1741 \n",
       "L 678 2272 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(0 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.623047 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(128.203125 39.046875) scale(0.7)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(186.855469 39.046875) scale(0.7)\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 51.378125 68.602551 \n",
       "L 246.678125 68.602551 \n",
       "\" clip-path=\"url(#pa52aeb5848)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6ab7cfe02\" x=\"51.378125\" y=\"68.602551\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- $\\mathdefault{10^{-1}}$ -->\n",
       "      <g transform=\"translate(20.878125 72.40177) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(0 0.684375)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.623047 0.684375)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(128.203125 38.965625) scale(0.7)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(186.855469 38.965625) scale(0.7)\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <defs>\n",
       "       <path id=\"mbb97ea1e36\" d=\"M 0 0 \n",
       "L -2 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"144.480947\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"140.942488\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"116.953575\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"104.772519\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"96.129923\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"89.426204\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_9\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"83.948867\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_10\">\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"79.317844\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_11\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"75.30627\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_12\">\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"71.767811\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_13\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"47.778899\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_14\">\n",
       "     <g id=\"line2d_24\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"35.597843\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_15\">\n",
       "     <g id=\"line2d_25\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"26.955246\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_16\">\n",
       "     <g id=\"line2d_26\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"20.251527\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_17\">\n",
       "     <g id=\"line2d_27\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"14.77419\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_18\">\n",
       "     <g id=\"line2d_28\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mbb97ea1e36\" x=\"51.378125\" y=\"10.143167\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_8\">\n",
       "     <!-- rmse -->\n",
       "     <g transform=\"translate(14.798437 89.019531) rotate(-90) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-72\" d=\"M 2631 2963 \n",
       "Q 2534 3019 2420 3045 \n",
       "Q 2306 3072 2169 3072 \n",
       "Q 1681 3072 1420 2755 \n",
       "Q 1159 2438 1159 1844 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2956 \n",
       "Q 1341 3275 1631 3429 \n",
       "Q 1922 3584 2338 3584 \n",
       "Q 2397 3584 2469 3576 \n",
       "Q 2541 3569 2628 3553 \n",
       "L 2631 2963 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6d\" d=\"M 3328 2828 \n",
       "Q 3544 3216 3844 3400 \n",
       "Q 4144 3584 4550 3584 \n",
       "Q 5097 3584 5394 3201 \n",
       "Q 5691 2819 5691 2113 \n",
       "L 5691 0 \n",
       "L 5113 0 \n",
       "L 5113 2094 \n",
       "Q 5113 2597 4934 2840 \n",
       "Q 4756 3084 4391 3084 \n",
       "Q 3944 3084 3684 2787 \n",
       "Q 3425 2491 3425 1978 \n",
       "L 3425 0 \n",
       "L 2847 0 \n",
       "L 2847 2094 \n",
       "Q 2847 2600 2669 2842 \n",
       "Q 2491 3084 2119 3084 \n",
       "Q 1678 3084 1418 2786 \n",
       "Q 1159 2488 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2956 \n",
       "Q 1356 3278 1631 3431 \n",
       "Q 1906 3584 2284 3584 \n",
       "Q 2666 3584 2933 3390 \n",
       "Q 3200 3197 3328 2828 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \n",
       "L 2834 2853 \n",
       "Q 2591 2978 2328 3040 \n",
       "Q 2066 3103 1784 3103 \n",
       "Q 1356 3103 1142 2972 \n",
       "Q 928 2841 928 2578 \n",
       "Q 928 2378 1081 2264 \n",
       "Q 1234 2150 1697 2047 \n",
       "L 1894 2003 \n",
       "Q 2506 1872 2764 1633 \n",
       "Q 3022 1394 3022 966 \n",
       "Q 3022 478 2636 193 \n",
       "Q 2250 -91 1575 -91 \n",
       "Q 1294 -91 989 -36 \n",
       "Q 684 19 347 128 \n",
       "L 347 722 \n",
       "Q 666 556 975 473 \n",
       "Q 1284 391 1588 391 \n",
       "Q 1994 391 2212 530 \n",
       "Q 2431 669 2431 922 \n",
       "Q 2431 1156 2273 1281 \n",
       "Q 2116 1406 1581 1522 \n",
       "L 1381 1569 \n",
       "Q 847 1681 609 1914 \n",
       "Q 372 2147 372 2553 \n",
       "Q 372 3047 722 3315 \n",
       "Q 1072 3584 1716 3584 \n",
       "Q 2034 3584 2315 3537 \n",
       "Q 2597 3491 2834 3397 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-72\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6d\" x=\"39.363281\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-73\" x=\"136.775391\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-65\" x=\"188.875\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_29\">\n",
       "    <path d=\"M 51.378125 15.783407 \n",
       "L 51.867599 53.027014 \n",
       "L 52.357072 53.516738 \n",
       "L 52.846546 60.670441 \n",
       "L 53.33602 56.225731 \n",
       "L 53.825493 61.447584 \n",
       "L 54.314967 62.477559 \n",
       "L 54.804441 60.393893 \n",
       "L 55.293914 62.420199 \n",
       "L 55.783388 60.012348 \n",
       "L 56.272862 66.878304 \n",
       "L 56.762336 68.37272 \n",
       "L 57.251809 69.508336 \n",
       "L 57.741283 66.488961 \n",
       "L 58.230757 69.700658 \n",
       "L 58.72023 65.082956 \n",
       "L 59.209704 64.617944 \n",
       "L 59.699178 70.729818 \n",
       "L 60.188651 72.694116 \n",
       "L 60.678125 75.352516 \n",
       "L 61.167599 72.294801 \n",
       "L 61.657072 76.181307 \n",
       "L 62.63602 72.236115 \n",
       "L 63.125493 74.118023 \n",
       "L 63.614967 77.776051 \n",
       "L 64.104441 60.503945 \n",
       "L 64.593914 77.638606 \n",
       "L 65.083388 79.175591 \n",
       "L 65.572862 79.485301 \n",
       "L 66.062336 80.702166 \n",
       "L 66.551809 79.860497 \n",
       "L 67.041283 82.706288 \n",
       "L 67.530757 81.444073 \n",
       "L 68.02023 81.016328 \n",
       "L 68.509704 84.050017 \n",
       "L 68.999178 84.151218 \n",
       "L 69.488651 85.141953 \n",
       "L 69.978125 83.508618 \n",
       "L 70.467599 84.190405 \n",
       "L 70.957072 86.323091 \n",
       "L 71.446546 86.234866 \n",
       "L 71.93602 80.305968 \n",
       "L 72.425493 82.229841 \n",
       "L 73.404441 88.340754 \n",
       "L 74.383388 91.060945 \n",
       "L 74.872862 90.092672 \n",
       "L 75.362336 92.149275 \n",
       "L 75.851809 87.099874 \n",
       "L 76.341283 87.598445 \n",
       "L 76.830757 87.872928 \n",
       "L 77.32023 87.437273 \n",
       "L 77.809704 88.423439 \n",
       "L 78.299178 87.263748 \n",
       "L 78.788651 82.388795 \n",
       "L 79.278125 50.735281 \n",
       "L 79.767599 79.489263 \n",
       "L 80.746546 87.373912 \n",
       "L 81.23602 81.541015 \n",
       "L 81.725493 90.721243 \n",
       "L 82.214967 90.516719 \n",
       "L 82.704441 93.357521 \n",
       "L 83.193914 89.598033 \n",
       "L 83.683388 88.269419 \n",
       "L 84.172862 89.327747 \n",
       "L 84.662336 91.866617 \n",
       "L 85.641283 87.43463 \n",
       "L 86.130757 88.886841 \n",
       "L 86.62023 93.347484 \n",
       "L 87.599178 100.037847 \n",
       "L 88.088651 93.647589 \n",
       "L 88.578125 93.981299 \n",
       "L 89.067599 96.318144 \n",
       "L 89.557072 95.763588 \n",
       "L 90.046546 97.1649 \n",
       "L 90.53602 88.948561 \n",
       "L 91.025493 32.49704 \n",
       "L 91.514967 32.539144 \n",
       "L 92.004441 43.822923 \n",
       "L 92.983388 87.421044 \n",
       "L 93.472862 92.162208 \n",
       "L 93.962336 100.536611 \n",
       "L 94.451809 97.202142 \n",
       "L 94.941283 90.73811 \n",
       "L 95.430757 103.244152 \n",
       "L 95.92023 98.281339 \n",
       "L 96.409704 101.238881 \n",
       "L 96.899178 98.911921 \n",
       "L 97.388651 101.259779 \n",
       "L 97.878125 101.815751 \n",
       "L 98.367599 106.64727 \n",
       "L 98.857072 104.870627 \n",
       "L 99.346546 106.298613 \n",
       "L 99.83602 105.706992 \n",
       "L 100.325493 104.20943 \n",
       "L 100.814967 106.660465 \n",
       "L 101.304441 100.756876 \n",
       "L 101.793914 105.075729 \n",
       "L 102.283388 105.85225 \n",
       "L 102.772862 103.134308 \n",
       "L 103.262336 92.997963 \n",
       "L 103.751809 102.806338 \n",
       "L 104.241283 95.633485 \n",
       "L 104.730757 103.490593 \n",
       "L 105.22023 101.916656 \n",
       "L 105.709704 95.27247 \n",
       "L 106.199178 90.748952 \n",
       "L 106.688651 99.965477 \n",
       "L 107.178125 83.599836 \n",
       "L 107.667599 99.027582 \n",
       "L 108.646546 111.95634 \n",
       "L 109.13602 108.922939 \n",
       "L 109.625493 101.21187 \n",
       "L 110.114967 111.040181 \n",
       "L 110.604441 104.031034 \n",
       "L 111.093914 94.981599 \n",
       "L 111.583388 103.00585 \n",
       "L 112.072862 101.71798 \n",
       "L 112.562336 104.646287 \n",
       "L 113.051809 110.244601 \n",
       "L 113.541283 114.360482 \n",
       "L 114.030757 110.999722 \n",
       "L 115.009704 108.812594 \n",
       "L 115.499178 94.452843 \n",
       "L 115.988651 109.219457 \n",
       "L 116.478125 107.182721 \n",
       "L 116.967599 113.834533 \n",
       "L 117.946546 109.381615 \n",
       "L 118.43602 109.236399 \n",
       "L 118.925493 109.702736 \n",
       "L 119.414967 113.913651 \n",
       "L 119.904441 109.591249 \n",
       "L 120.393914 110.400941 \n",
       "L 120.883388 112.515263 \n",
       "L 121.372862 108.398492 \n",
       "L 121.862336 92.858345 \n",
       "L 122.841283 103.285727 \n",
       "L 123.330757 93.960875 \n",
       "L 123.82023 102.770705 \n",
       "L 124.309704 101.748554 \n",
       "L 124.799178 104.769523 \n",
       "L 125.778125 112.6543 \n",
       "L 126.267599 114.840009 \n",
       "L 126.757072 112.779943 \n",
       "L 127.246546 108.506662 \n",
       "L 127.73602 97.766502 \n",
       "L 128.225493 107.907744 \n",
       "L 128.714967 89.418205 \n",
       "L 129.204441 98.358538 \n",
       "L 129.693914 102.887895 \n",
       "L 130.183388 90.399554 \n",
       "L 130.672862 103.003782 \n",
       "L 131.162336 101.480767 \n",
       "L 131.651809 88.842012 \n",
       "L 132.141283 95.981805 \n",
       "L 132.630757 105.025496 \n",
       "L 133.12023 100.080679 \n",
       "L 133.609704 115.16538 \n",
       "L 134.099178 111.911708 \n",
       "L 134.588651 119.163595 \n",
       "L 135.078125 121.653118 \n",
       "L 135.567599 115.93181 \n",
       "L 136.057072 116.544032 \n",
       "L 136.546546 113.125906 \n",
       "L 137.03602 115.029532 \n",
       "L 137.525493 115.977957 \n",
       "L 138.014967 117.648881 \n",
       "L 138.504441 117.604233 \n",
       "L 138.993914 110.201427 \n",
       "L 139.483388 115.062073 \n",
       "L 139.972862 123.710132 \n",
       "L 140.462336 104.398406 \n",
       "L 140.951809 100.552277 \n",
       "L 141.441283 111.395713 \n",
       "L 141.930757 106.5799 \n",
       "L 142.42023 103.332398 \n",
       "L 142.909704 109.023892 \n",
       "L 143.399178 100.705174 \n",
       "L 143.888651 108.030844 \n",
       "L 144.378125 93.986767 \n",
       "L 144.867599 101.807242 \n",
       "L 145.357072 102.500799 \n",
       "L 145.846546 113.472767 \n",
       "L 146.33602 103.564008 \n",
       "L 146.825493 105.502469 \n",
       "L 147.804441 84.433812 \n",
       "L 148.293914 89.042726 \n",
       "L 148.783388 76.691498 \n",
       "L 149.272862 92.63969 \n",
       "L 149.762336 98.781566 \n",
       "L 150.251809 97.223922 \n",
       "L 150.741283 85.514636 \n",
       "L 151.230757 96.29247 \n",
       "L 151.72023 93.85791 \n",
       "L 152.209704 92.877885 \n",
       "L 152.699178 94.55931 \n",
       "L 153.188651 106.253226 \n",
       "L 154.167599 113.818575 \n",
       "L 154.657072 112.96163 \n",
       "L 155.146546 117.900557 \n",
       "L 155.63602 105.142893 \n",
       "L 156.125493 120.485009 \n",
       "L 156.614967 110.420645 \n",
       "L 157.104441 121.682715 \n",
       "L 158.083388 115.515181 \n",
       "L 158.572862 116.559133 \n",
       "L 159.062336 124.446329 \n",
       "L 159.551809 119.369462 \n",
       "L 160.041283 94.303808 \n",
       "L 160.530757 83.669136 \n",
       "L 161.02023 98.564278 \n",
       "L 161.509704 94.873781 \n",
       "L 161.999178 118.903261 \n",
       "L 162.488651 101.248421 \n",
       "L 162.978125 95.231569 \n",
       "L 163.467599 77.713325 \n",
       "L 163.957072 97.78291 \n",
       "L 164.446546 105.919663 \n",
       "L 164.93602 107.4977 \n",
       "L 165.425493 109.452035 \n",
       "L 165.914967 99.161199 \n",
       "L 166.404441 108.752589 \n",
       "L 166.893914 112.722308 \n",
       "L 167.383388 122.158309 \n",
       "L 167.872862 115.956533 \n",
       "L 168.851809 115.872789 \n",
       "L 169.341283 118.645281 \n",
       "L 170.32023 113.349914 \n",
       "L 170.809704 111.616923 \n",
       "L 171.299178 118.272873 \n",
       "L 171.788651 101.125506 \n",
       "L 172.278125 109.200854 \n",
       "L 172.767599 112.620892 \n",
       "L 173.257072 119.221498 \n",
       "L 173.746546 119.907751 \n",
       "L 174.23602 121.211186 \n",
       "L 174.725493 118.785621 \n",
       "L 175.704441 122.203256 \n",
       "L 176.193914 116.679326 \n",
       "L 176.683388 116.49544 \n",
       "L 177.172862 112.571188 \n",
       "L 178.151809 121.508033 \n",
       "L 178.641283 123.218029 \n",
       "L 179.130757 103.19308 \n",
       "L 179.62023 111.597449 \n",
       "L 180.109704 110.539026 \n",
       "L 180.599178 115.231606 \n",
       "L 181.088651 90.573025 \n",
       "L 181.578125 74.526073 \n",
       "L 182.067599 69.368476 \n",
       "L 183.046546 81.190801 \n",
       "L 183.53602 73.115346 \n",
       "L 184.025493 92.181031 \n",
       "L 184.514967 87.973248 \n",
       "L 185.004441 89.68073 \n",
       "L 185.493914 101.969853 \n",
       "L 185.983388 91.266343 \n",
       "L 186.472862 112.887689 \n",
       "L 186.962336 111.169082 \n",
       "L 187.451809 117.797739 \n",
       "L 187.941283 104.095357 \n",
       "L 188.430757 116.501318 \n",
       "L 188.92023 107.732134 \n",
       "L 189.409704 119.66469 \n",
       "L 190.388651 132.982338 \n",
       "L 190.878125 134.167547 \n",
       "L 191.367599 136.473934 \n",
       "L 191.857072 134.900992 \n",
       "L 192.346546 136.295674 \n",
       "L 192.83602 132.298618 \n",
       "L 193.325493 109.652571 \n",
       "L 193.814967 107.785186 \n",
       "L 194.304441 108.618579 \n",
       "L 195.283388 131.872873 \n",
       "L 195.772862 123.628087 \n",
       "L 196.262336 123.609714 \n",
       "L 196.751809 124.950262 \n",
       "L 197.241283 108.922055 \n",
       "L 197.730757 111.550042 \n",
       "L 198.22023 107.384126 \n",
       "L 198.709704 102.063937 \n",
       "L 199.199178 118.719977 \n",
       "L 199.688651 91.270877 \n",
       "L 200.178125 83.404078 \n",
       "L 200.667599 107.832487 \n",
       "L 201.157072 110.729022 \n",
       "L 201.646546 116.618808 \n",
       "L 202.13602 117.433635 \n",
       "L 202.625493 118.581021 \n",
       "L 203.114967 118.991268 \n",
       "L 203.604441 112.053858 \n",
       "L 205.072862 132.62169 \n",
       "L 205.562336 123.901916 \n",
       "L 206.051809 128.356844 \n",
       "L 206.541283 139.5 \n",
       "L 207.030757 137.061708 \n",
       "L 207.52023 121.282144 \n",
       "L 208.009704 132.16379 \n",
       "L 208.499178 125.980997 \n",
       "L 208.988651 124.064575 \n",
       "L 209.478125 100.527184 \n",
       "L 209.967599 118.505246 \n",
       "L 210.457072 123.253039 \n",
       "L 210.946546 121.632896 \n",
       "L 211.43602 129.118286 \n",
       "L 211.925493 126.272522 \n",
       "L 212.414967 114.561669 \n",
       "L 212.904441 115.724179 \n",
       "L 213.393914 83.004012 \n",
       "L 213.883388 82.645818 \n",
       "L 214.372862 86.901224 \n",
       "L 214.862336 96.005563 \n",
       "L 215.841283 106.446408 \n",
       "L 216.330757 113.134775 \n",
       "L 216.82023 100.531185 \n",
       "L 217.309704 105.504837 \n",
       "L 217.799178 123.810557 \n",
       "L 218.288651 120.385499 \n",
       "L 218.778125 123.002711 \n",
       "L 219.267599 130.442607 \n",
       "L 219.757072 114.472293 \n",
       "L 220.246546 108.989619 \n",
       "L 220.73602 110.180073 \n",
       "L 221.225493 109.849805 \n",
       "L 221.714967 116.531452 \n",
       "L 222.204441 115.211628 \n",
       "L 222.693914 116.40179 \n",
       "L 223.183388 97.412112 \n",
       "L 224.162336 113.638735 \n",
       "L 224.651809 123.526688 \n",
       "L 225.141283 118.332586 \n",
       "L 225.630757 118.853167 \n",
       "L 226.12023 122.313401 \n",
       "L 226.609704 112.875693 \n",
       "L 227.099178 106.90243 \n",
       "L 227.588651 121.190573 \n",
       "L 228.078125 115.555978 \n",
       "L 228.567599 113.923962 \n",
       "L 229.057072 99.068275 \n",
       "L 229.546546 107.277199 \n",
       "L 230.03602 119.993089 \n",
       "L 230.525493 111.777009 \n",
       "L 231.014967 121.344995 \n",
       "L 231.504441 104.326105 \n",
       "L 231.993914 114.051722 \n",
       "L 232.483388 109.965791 \n",
       "L 232.972862 108.000986 \n",
       "L 233.462336 106.924494 \n",
       "L 233.951809 99.819488 \n",
       "L 234.441283 111.683499 \n",
       "L 234.930757 104.583708 \n",
       "L 235.42023 104.487541 \n",
       "L 235.909704 122.517177 \n",
       "L 236.399178 125.009987 \n",
       "L 236.888651 130.975878 \n",
       "L 237.378125 128.669323 \n",
       "L 237.867599 125.059747 \n",
       "L 238.357072 129.680679 \n",
       "L 238.846546 130.341902 \n",
       "L 239.33602 125.627662 \n",
       "L 239.825493 99.982553 \n",
       "L 240.314967 108.376781 \n",
       "L 240.804441 121.520607 \n",
       "L 241.293914 125.49457 \n",
       "L 241.783388 116.68623 \n",
       "L 242.272862 114.666328 \n",
       "L 242.762336 131.20852 \n",
       "L 243.251809 123.839536 \n",
       "L 243.741283 89.841897 \n",
       "L 244.230757 94.29969 \n",
       "L 244.72023 70.431743 \n",
       "L 245.209704 78.552393 \n",
       "L 245.699178 67.524086 \n",
       "L 246.188651 69.051797 \n",
       "L 246.678125 71.521661 \n",
       "L 246.678125 71.521661 \n",
       "\" clip-path=\"url(#pa52aeb5848)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_30\">\n",
       "    <path d=\"M 51.378125 13.5 \n",
       "L 51.867599 56.267336 \n",
       "L 52.357072 53.663649 \n",
       "L 52.846546 59.993025 \n",
       "L 53.33602 56.327337 \n",
       "L 53.825493 55.021302 \n",
       "L 54.314967 57.910957 \n",
       "L 54.804441 57.561808 \n",
       "L 55.293914 54.562585 \n",
       "L 55.783388 50.78711 \n",
       "L 56.272862 59.654198 \n",
       "L 56.762336 60.174998 \n",
       "L 57.741283 55.624076 \n",
       "L 58.230757 61.949608 \n",
       "L 58.72023 60.266325 \n",
       "L 59.209704 60.028847 \n",
       "L 60.188651 63.768058 \n",
       "L 60.678125 63.520061 \n",
       "L 61.167599 60.349538 \n",
       "L 61.657072 64.460515 \n",
       "L 62.146546 63.685611 \n",
       "L 62.63602 59.705986 \n",
       "L 63.125493 63.466756 \n",
       "L 63.614967 63.631673 \n",
       "L 64.104441 64.415226 \n",
       "L 64.593914 62.428284 \n",
       "L 65.083388 62.288363 \n",
       "L 65.572862 63.91612 \n",
       "L 66.551809 61.673239 \n",
       "L 67.041283 62.345431 \n",
       "L 67.530757 63.796728 \n",
       "L 68.02023 60.660827 \n",
       "L 68.509704 62.420895 \n",
       "L 68.999178 60.723258 \n",
       "L 69.488651 62.291044 \n",
       "L 69.978125 60.812739 \n",
       "L 70.467599 62.05696 \n",
       "L 70.957072 61.453932 \n",
       "L 71.446546 61.719701 \n",
       "L 71.93602 60.957303 \n",
       "L 72.425493 59.54157 \n",
       "L 72.914967 61.982107 \n",
       "L 73.404441 61.414151 \n",
       "L 73.893914 60.178701 \n",
       "L 74.383388 60.721036 \n",
       "L 74.872862 62.214137 \n",
       "L 75.362336 60.621677 \n",
       "L 75.851809 59.571617 \n",
       "L 76.341283 60.215341 \n",
       "L 76.830757 59.72176 \n",
       "L 77.32023 60.270989 \n",
       "L 77.809704 59.441601 \n",
       "L 78.299178 60.190964 \n",
       "L 78.788651 56.896885 \n",
       "L 79.278125 60.922338 \n",
       "L 79.767599 59.648246 \n",
       "L 81.23602 60.300504 \n",
       "L 82.214967 59.952306 \n",
       "L 82.704441 60.858755 \n",
       "L 83.193914 56.757804 \n",
       "L 83.683388 59.721517 \n",
       "L 84.172862 57.433444 \n",
       "L 84.662336 59.68425 \n",
       "L 85.151809 56.856653 \n",
       "L 85.641283 60.186183 \n",
       "L 86.130757 58.219755 \n",
       "L 86.62023 59.085827 \n",
       "L 87.109704 59.313013 \n",
       "L 87.599178 59.388399 \n",
       "L 88.088651 59.099514 \n",
       "L 88.578125 59.291639 \n",
       "L 89.067599 59.003305 \n",
       "L 89.557072 59.307651 \n",
       "L 90.046546 57.11191 \n",
       "L 90.53602 56.436005 \n",
       "L 91.025493 58.89356 \n",
       "L 91.514967 55.091974 \n",
       "L 92.004441 57.826047 \n",
       "L 92.493914 58.787834 \n",
       "L 92.983388 57.467385 \n",
       "L 93.472862 57.148279 \n",
       "L 93.962336 58.638284 \n",
       "L 94.451809 57.772394 \n",
       "L 94.941283 57.4213 \n",
       "L 95.430757 58.892611 \n",
       "L 95.92023 57.549938 \n",
       "L 96.409704 57.845611 \n",
       "L 96.899178 58.699238 \n",
       "L 97.388651 57.558634 \n",
       "L 97.878125 58.590109 \n",
       "L 98.857072 58.086161 \n",
       "L 99.346546 58.400549 \n",
       "L 99.83602 57.806592 \n",
       "L 100.325493 58.993345 \n",
       "L 100.814967 57.549101 \n",
       "L 101.304441 59.539991 \n",
       "L 101.793914 57.346587 \n",
       "L 102.283388 57.467419 \n",
       "L 102.772862 58.858031 \n",
       "L 103.262336 56.762476 \n",
       "L 103.751809 58.939842 \n",
       "L 104.241283 56.802063 \n",
       "L 104.730757 58.275471 \n",
       "L 105.22023 58.088911 \n",
       "L 105.709704 57.178487 \n",
       "L 106.199178 56.858085 \n",
       "L 106.688651 58.968438 \n",
       "L 107.178125 55.764395 \n",
       "L 107.667599 57.876667 \n",
       "L 108.157072 58.534121 \n",
       "L 108.646546 56.78603 \n",
       "L 109.13602 58.497674 \n",
       "L 109.625493 56.170567 \n",
       "L 110.114967 56.619042 \n",
       "L 110.604441 58.088053 \n",
       "L 111.583388 57.325995 \n",
       "L 112.072862 56.361296 \n",
       "L 112.562336 57.113749 \n",
       "L 113.051809 57.28672 \n",
       "L 113.541283 56.809018 \n",
       "L 114.52023 56.451168 \n",
       "L 115.009704 56.051027 \n",
       "L 115.499178 54.18144 \n",
       "L 115.988651 57.27424 \n",
       "L 116.478125 55.130379 \n",
       "L 116.967599 56.722092 \n",
       "L 117.457072 55.582624 \n",
       "L 117.946546 55.928802 \n",
       "L 118.43602 54.91151 \n",
       "L 118.925493 55.290441 \n",
       "L 119.414967 56.321783 \n",
       "L 119.904441 56.015053 \n",
       "L 120.393914 56.362749 \n",
       "L 120.883388 55.15717 \n",
       "L 121.372862 56.579417 \n",
       "L 122.351809 56.390436 \n",
       "L 122.841283 54.457845 \n",
       "L 123.330757 56.343091 \n",
       "L 123.82023 54.33441 \n",
       "L 124.309704 57.072283 \n",
       "L 124.799178 54.96073 \n",
       "L 125.288651 55.64304 \n",
       "L 125.778125 55.629471 \n",
       "L 126.267599 56.066856 \n",
       "L 126.757072 54.634676 \n",
       "L 127.246546 56.444519 \n",
       "L 127.73602 55.805745 \n",
       "L 128.225493 55.697418 \n",
       "L 128.714967 53.896558 \n",
       "L 129.204441 54.741063 \n",
       "L 129.693914 54.640115 \n",
       "L 130.183388 56.277112 \n",
       "L 130.672862 55.044638 \n",
       "L 131.162336 56.99532 \n",
       "L 131.651809 51.638089 \n",
       "L 132.630757 55.294121 \n",
       "L 133.12023 54.819863 \n",
       "L 133.609704 55.775854 \n",
       "L 134.099178 55.059873 \n",
       "L 135.078125 54.888967 \n",
       "L 135.567599 55.729499 \n",
       "L 136.057072 54.766357 \n",
       "L 136.546546 54.288716 \n",
       "L 137.03602 55.827152 \n",
       "L 137.525493 54.693157 \n",
       "L 138.014967 55.062349 \n",
       "L 138.504441 54.505774 \n",
       "L 138.993914 54.823643 \n",
       "L 139.483388 55.470332 \n",
       "L 139.972862 54.662802 \n",
       "L 140.462336 53.168365 \n",
       "L 140.951809 54.307216 \n",
       "L 141.441283 54.559914 \n",
       "L 141.930757 56.493293 \n",
       "L 142.42023 54.364483 \n",
       "L 142.909704 55.092994 \n",
       "L 143.399178 55.030769 \n",
       "L 143.888651 54.36853 \n",
       "L 144.378125 56.605743 \n",
       "L 144.867599 53.47158 \n",
       "L 145.357072 54.014156 \n",
       "L 145.846546 53.813928 \n",
       "L 146.33602 54.182204 \n",
       "L 146.825493 53.356409 \n",
       "L 147.314967 54.320885 \n",
       "L 147.804441 50.948405 \n",
       "L 148.293914 55.169179 \n",
       "L 148.783388 49.688732 \n",
       "L 149.272862 55.085751 \n",
       "L 149.762336 55.667236 \n",
       "L 150.251809 55.297211 \n",
       "L 150.741283 54.315064 \n",
       "L 151.230757 54.308443 \n",
       "L 151.72023 54.008014 \n",
       "L 152.209704 55.350617 \n",
       "L 152.699178 53.996482 \n",
       "L 153.188651 55.775495 \n",
       "L 153.678125 53.437661 \n",
       "L 154.167599 54.826139 \n",
       "L 154.657072 54.11741 \n",
       "L 155.146546 54.675454 \n",
       "L 155.63602 55.565781 \n",
       "L 156.125493 54.752452 \n",
       "L 157.104441 54.958874 \n",
       "L 157.593914 54.349961 \n",
       "L 158.083388 55.709563 \n",
       "L 158.572862 54.020779 \n",
       "L 159.062336 54.719265 \n",
       "L 159.551809 54.888885 \n",
       "L 160.041283 52.744348 \n",
       "L 160.530757 53.946461 \n",
       "L 161.02023 53.529098 \n",
       "L 161.509704 55.446493 \n",
       "L 162.488651 53.18752 \n",
       "L 162.978125 55.220856 \n",
       "L 163.467599 51.217358 \n",
       "L 163.957072 54.431438 \n",
       "L 164.446546 56.145628 \n",
       "L 164.93602 55.287944 \n",
       "L 165.425493 56.225352 \n",
       "L 165.914967 56.169851 \n",
       "L 166.404441 55.205212 \n",
       "L 166.893914 56.014058 \n",
       "L 167.383388 56.087815 \n",
       "L 167.872862 54.948105 \n",
       "L 168.362336 55.49228 \n",
       "L 168.851809 55.711382 \n",
       "L 169.341283 54.683151 \n",
       "L 169.830757 55.59236 \n",
       "L 170.32023 54.19419 \n",
       "L 170.809704 54.792681 \n",
       "L 171.299178 55.141634 \n",
       "L 171.788651 53.468839 \n",
       "L 172.278125 54.664488 \n",
       "L 172.767599 54.922107 \n",
       "L 173.257072 54.884906 \n",
       "L 173.746546 54.339467 \n",
       "L 174.23602 55.288306 \n",
       "L 174.725493 54.96583 \n",
       "L 175.214967 55.428606 \n",
       "L 175.704441 55.175257 \n",
       "L 176.193914 55.13743 \n",
       "L 177.172862 54.270291 \n",
       "L 177.662336 55.280102 \n",
       "L 178.151809 54.52138 \n",
       "L 178.641283 54.469437 \n",
       "L 179.130757 54.82874 \n",
       "L 180.109704 54.266313 \n",
       "L 180.599178 55.131497 \n",
       "L 181.088651 55.458011 \n",
       "L 181.578125 52.244684 \n",
       "L 182.067599 53.201542 \n",
       "L 182.557072 52.302305 \n",
       "L 183.046546 55.959245 \n",
       "L 183.53602 50.700539 \n",
       "L 184.025493 56.37009 \n",
       "L 184.514967 53.118085 \n",
       "L 185.004441 56.930541 \n",
       "L 185.493914 54.637564 \n",
       "L 185.983388 53.61061 \n",
       "L 186.472862 56.468927 \n",
       "L 186.962336 55.907443 \n",
       "L 187.451809 55.121003 \n",
       "L 187.941283 55.738326 \n",
       "L 188.430757 55.288341 \n",
       "L 188.92023 55.293793 \n",
       "L 189.409704 55.003729 \n",
       "L 189.899178 55.228605 \n",
       "L 190.878125 55.04177 \n",
       "L 191.367599 55.254051 \n",
       "L 191.857072 55.209201 \n",
       "L 192.346546 55.321976 \n",
       "L 192.83602 55.131631 \n",
       "L 193.325493 55.357098 \n",
       "L 193.814967 53.902944 \n",
       "L 194.304441 55.20778 \n",
       "L 194.793914 54.772876 \n",
       "L 195.283388 54.667542 \n",
       "L 195.772862 54.804989 \n",
       "L 196.262336 54.5221 \n",
       "L 196.751809 54.449736 \n",
       "L 197.241283 53.787557 \n",
       "L 197.730757 55.753932 \n",
       "L 198.22023 53.181521 \n",
       "L 198.709704 56.2992 \n",
       "L 199.199178 54.417766 \n",
       "L 199.688651 53.163848 \n",
       "L 200.178125 54.898132 \n",
       "L 200.667599 54.777029 \n",
       "L 201.157072 54.798083 \n",
       "L 201.646546 55.100533 \n",
       "L 202.13602 55.84541 \n",
       "L 202.625493 54.562877 \n",
       "L 203.114967 54.366339 \n",
       "L 203.604441 54.309887 \n",
       "L 204.093914 55.357294 \n",
       "L 204.583388 55.325552 \n",
       "L 205.072862 55.154226 \n",
       "L 206.051809 54.240665 \n",
       "L 206.541283 55.21982 \n",
       "L 207.52023 54.656267 \n",
       "L 208.009704 54.636304 \n",
       "L 208.499178 55.398699 \n",
       "L 209.478125 53.570559 \n",
       "L 209.967599 54.740956 \n",
       "L 210.457072 55.103869 \n",
       "L 210.946546 54.624363 \n",
       "L 211.43602 54.800922 \n",
       "L 211.925493 55.228785 \n",
       "L 212.414967 54.437212 \n",
       "L 212.904441 54.766167 \n",
       "L 213.393914 56.215762 \n",
       "L 213.883388 52.852506 \n",
       "L 215.351809 56.290662 \n",
       "L 215.841283 55.986645 \n",
       "L 216.330757 55.228507 \n",
       "L 216.82023 54.171874 \n",
       "L 217.309704 54.874396 \n",
       "L 217.799178 54.934977 \n",
       "L 218.288651 56.041749 \n",
       "L 218.778125 54.756507 \n",
       "L 219.267599 55.344253 \n",
       "L 219.757072 54.387406 \n",
       "L 220.246546 56.115696 \n",
       "L 220.73602 54.81348 \n",
       "L 221.225493 54.957339 \n",
       "L 221.714967 54.836168 \n",
       "L 222.204441 55.276232 \n",
       "L 222.693914 54.807865 \n",
       "L 223.183388 53.436972 \n",
       "L 223.672862 54.264974 \n",
       "L 224.162336 55.981624 \n",
       "L 224.651809 55.567632 \n",
       "L 225.141283 54.659976 \n",
       "L 226.12023 54.855963 \n",
       "L 227.099178 55.470161 \n",
       "L 227.588651 54.833608 \n",
       "L 228.078125 55.860149 \n",
       "L 228.567599 55.015771 \n",
       "L 229.057072 52.992704 \n",
       "L 229.546546 55.239382 \n",
       "L 230.03602 54.508364 \n",
       "L 230.525493 55.407697 \n",
       "L 231.014967 55.594752 \n",
       "L 231.504441 54.712201 \n",
       "L 231.993914 56.390114 \n",
       "L 232.972862 54.722325 \n",
       "L 233.462336 54.875434 \n",
       "L 233.951809 53.479629 \n",
       "L 234.441283 55.339889 \n",
       "L 234.930757 53.80975 \n",
       "L 235.42023 54.704954 \n",
       "L 235.909704 54.812111 \n",
       "L 236.399178 55.354627 \n",
       "L 236.888651 55.107811 \n",
       "L 237.378125 55.632506 \n",
       "L 237.867599 55.215522 \n",
       "L 238.357072 55.156847 \n",
       "L 238.846546 54.894291 \n",
       "L 239.33602 55.552154 \n",
       "L 239.825493 55.197569 \n",
       "L 240.314967 54.147427 \n",
       "L 240.804441 54.427257 \n",
       "L 241.293914 54.843053 \n",
       "L 241.783388 53.952849 \n",
       "L 242.272862 54.751447 \n",
       "L 243.251809 55.153407 \n",
       "L 243.741283 52.242988 \n",
       "L 244.230757 54.632795 \n",
       "L 244.72023 49.021188 \n",
       "L 245.209704 53.559408 \n",
       "L 245.699178 49.390952 \n",
       "L 246.188651 49.08115 \n",
       "L 246.678125 55.83873 \n",
       "L 246.678125 55.83873 \n",
       "\" clip-path=\"url(#pa52aeb5848)\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #bf00bf; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 51.378125 145.8 \n",
       "L 51.378125 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 246.678125 145.8 \n",
       "L 246.678125 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 51.378125 145.8 \n",
       "L 246.678125 145.8 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 51.378125 7.2 \n",
       "L 246.678125 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"legend_1\">\n",
       "    <g id=\"patch_7\">\n",
       "     <path d=\"M 183.726562 44.55625 \n",
       "L 239.678125 44.55625 \n",
       "Q 241.678125 44.55625 241.678125 42.55625 \n",
       "L 241.678125 14.2 \n",
       "Q 241.678125 12.2 239.678125 12.2 \n",
       "L 183.726562 12.2 \n",
       "Q 181.726562 12.2 181.726562 14.2 \n",
       "L 181.726562 42.55625 \n",
       "Q 181.726562 44.55625 183.726562 44.55625 \n",
       "z\n",
       "\" style=\"fill: #ffffff; opacity: 0.8; stroke: #cccccc; stroke-linejoin: miter\"/>\n",
       "    </g>\n",
       "    <g id=\"line2d_31\">\n",
       "     <path d=\"M 185.726562 20.298438 \n",
       "L 195.726562 20.298438 \n",
       "L 205.726562 20.298438 \n",
       "\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "    </g>\n",
       "    <g id=\"text_9\">\n",
       "     <!-- train -->\n",
       "     <g transform=\"translate(213.726562 23.798438) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-74\" d=\"M 1172 4494 \n",
       "L 1172 3500 \n",
       "L 2356 3500 \n",
       "L 2356 3053 \n",
       "L 1172 3053 \n",
       "L 1172 1153 \n",
       "Q 1172 725 1289 603 \n",
       "Q 1406 481 1766 481 \n",
       "L 2356 481 \n",
       "L 2356 0 \n",
       "L 1766 0 \n",
       "Q 1100 0 847 248 \n",
       "Q 594 497 594 1153 \n",
       "L 594 3053 \n",
       "L 172 3053 \n",
       "L 172 3500 \n",
       "L 594 3500 \n",
       "L 594 4494 \n",
       "L 1172 4494 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-61\" d=\"M 2194 1759 \n",
       "Q 1497 1759 1228 1600 \n",
       "Q 959 1441 959 1056 \n",
       "Q 959 750 1161 570 \n",
       "Q 1363 391 1709 391 \n",
       "Q 2188 391 2477 730 \n",
       "Q 2766 1069 2766 1631 \n",
       "L 2766 1759 \n",
       "L 2194 1759 \n",
       "z\n",
       "M 3341 1997 \n",
       "L 3341 0 \n",
       "L 2766 0 \n",
       "L 2766 531 \n",
       "Q 2569 213 2275 61 \n",
       "Q 1981 -91 1556 -91 \n",
       "Q 1019 -91 701 211 \n",
       "Q 384 513 384 1019 \n",
       "Q 384 1609 779 1909 \n",
       "Q 1175 2209 1959 2209 \n",
       "L 2766 2209 \n",
       "L 2766 2266 \n",
       "Q 2766 2663 2505 2880 \n",
       "Q 2244 3097 1772 3097 \n",
       "Q 1472 3097 1187 3025 \n",
       "Q 903 2953 641 2809 \n",
       "L 641 3341 \n",
       "Q 956 3463 1253 3523 \n",
       "Q 1550 3584 1831 3584 \n",
       "Q 2591 3584 2966 3190 \n",
       "Q 3341 2797 3341 1997 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-69\" d=\"M 603 3500 \n",
       "L 1178 3500 \n",
       "L 1178 0 \n",
       "L 603 0 \n",
       "L 603 3500 \n",
       "z\n",
       "M 603 4863 \n",
       "L 1178 4863 \n",
       "L 1178 4134 \n",
       "L 603 4134 \n",
       "L 603 4863 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6e\" d=\"M 3513 2113 \n",
       "L 3513 0 \n",
       "L 2938 0 \n",
       "L 2938 2094 \n",
       "Q 2938 2591 2744 2837 \n",
       "Q 2550 3084 2163 3084 \n",
       "Q 1697 3084 1428 2787 \n",
       "Q 1159 2491 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2956 \n",
       "Q 1366 3272 1645 3428 \n",
       "Q 1925 3584 2291 3584 \n",
       "Q 2894 3584 3203 3211 \n",
       "Q 3513 2838 3513 2113 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-74\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-72\" x=\"39.208984\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-61\" x=\"80.322266\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-69\" x=\"141.601562\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6e\" x=\"169.384766\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"line2d_32\">\n",
       "     <path d=\"M 185.726562 34.976562 \n",
       "L 195.726562 34.976562 \n",
       "L 205.726562 34.976562 \n",
       "\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #bf00bf; stroke-width: 1.5\"/>\n",
       "    </g>\n",
       "    <g id=\"text_10\">\n",
       "     <!-- valid -->\n",
       "     <g transform=\"translate(213.726562 38.476562) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-76\" d=\"M 191 3500 \n",
       "L 800 3500 \n",
       "L 1894 563 \n",
       "L 2988 3500 \n",
       "L 3597 3500 \n",
       "L 2284 0 \n",
       "L 1503 0 \n",
       "L 191 3500 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \n",
       "L 1178 4863 \n",
       "L 1178 0 \n",
       "L 603 0 \n",
       "L 603 4863 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-64\" d=\"M 2906 2969 \n",
       "L 2906 4863 \n",
       "L 3481 4863 \n",
       "L 3481 0 \n",
       "L 2906 0 \n",
       "L 2906 525 \n",
       "Q 2725 213 2448 61 \n",
       "Q 2172 -91 1784 -91 \n",
       "Q 1150 -91 751 415 \n",
       "Q 353 922 353 1747 \n",
       "Q 353 2572 751 3078 \n",
       "Q 1150 3584 1784 3584 \n",
       "Q 2172 3584 2448 3432 \n",
       "Q 2725 3281 2906 2969 \n",
       "z\n",
       "M 947 1747 \n",
       "Q 947 1113 1208 752 \n",
       "Q 1469 391 1925 391 \n",
       "Q 2381 391 2643 752 \n",
       "Q 2906 1113 2906 1747 \n",
       "Q 2906 2381 2643 2742 \n",
       "Q 2381 3103 1925 3103 \n",
       "Q 1469 3103 1208 2742 \n",
       "Q 947 2381 947 1747 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-76\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-61\" x=\"59.179688\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6c\" x=\"120.458984\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-69\" x=\"148.242188\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-64\" x=\"176.025391\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pa52aeb5848\">\n",
       "   <rect x=\"51.378125\" y=\"7.2\" width=\"195.3\" height=\"138.6\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 350x250 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "k,num_epochs,lr,weight_decay,batch_size=5,400,0.1,3,64\n",
    "train_l,valid_l=k_fold(k,x_train=train_features,y_train=train_labels,\n",
    "                       num_epochs=num_epochs,\n",
    "                       learning_rate=lr,\n",
    "                       weight_decay=weight_decay,\n",
    "                       batch_size=batch_size\n",
    "                       )\n",
    "print(f'{k}-折验证：平均训练log mse{float(train_l)},验证log rmse{float(valid_l)}')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 预测"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "通过这种方式获得的模型可以应用于测试集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "训练log rmse:0.6500702500343323\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"280.421875pt\" height=\"185.463719pt\" viewBox=\"0 0 280.421875 185.463719\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2025-01-16T13:25:28.194510</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 185.463719 \n",
       "L 280.421875 185.463719 \n",
       "L 280.421875 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 68.378125 147.907469 \n",
       "L 263.678125 147.907469 \n",
       "L 263.678125 9.307469 \n",
       "L 68.378125 9.307469 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 105.859943 147.907469 \n",
       "L 105.859943 9.307469 \n",
       "\" clip-path=\"url(#p0234fd3f20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\">\n",
       "      <defs>\n",
       "       <path id=\"me1b5e33847\" d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#me1b5e33847\" x=\"105.859943\" y=\"147.907469\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- 20 -->\n",
       "      <g transform=\"translate(99.497443 162.505907) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 145.314489 147.907469 \n",
       "L 145.314489 9.307469 \n",
       "\" clip-path=\"url(#p0234fd3f20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#me1b5e33847\" x=\"145.314489\" y=\"147.907469\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- 40 -->\n",
       "      <g transform=\"translate(138.951989 162.505907) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
       "L 825 1625 \n",
       "L 2419 1625 \n",
       "L 2419 4116 \n",
       "z\n",
       "M 2253 4666 \n",
       "L 3047 4666 \n",
       "L 3047 1625 \n",
       "L 3713 1625 \n",
       "L 3713 1100 \n",
       "L 3047 1100 \n",
       "L 3047 0 \n",
       "L 2419 0 \n",
       "L 2419 1100 \n",
       "L 313 1100 \n",
       "L 313 1709 \n",
       "L 2253 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-34\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 184.769034 147.907469 \n",
       "L 184.769034 9.307469 \n",
       "\" clip-path=\"url(#p0234fd3f20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#me1b5e33847\" x=\"184.769034\" y=\"147.907469\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 60 -->\n",
       "      <g transform=\"translate(178.406534 162.505907) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \n",
       "Q 1688 2584 1439 2293 \n",
       "Q 1191 2003 1191 1497 \n",
       "Q 1191 994 1439 701 \n",
       "Q 1688 409 2113 409 \n",
       "Q 2538 409 2786 701 \n",
       "Q 3034 994 3034 1497 \n",
       "Q 3034 2003 2786 2293 \n",
       "Q 2538 2584 2113 2584 \n",
       "z\n",
       "M 3366 4563 \n",
       "L 3366 3988 \n",
       "Q 3128 4100 2886 4159 \n",
       "Q 2644 4219 2406 4219 \n",
       "Q 1781 4219 1451 3797 \n",
       "Q 1122 3375 1075 2522 \n",
       "Q 1259 2794 1537 2939 \n",
       "Q 1816 3084 2150 3084 \n",
       "Q 2853 3084 3261 2657 \n",
       "Q 3669 2231 3669 1497 \n",
       "Q 3669 778 3244 343 \n",
       "Q 2819 -91 2113 -91 \n",
       "Q 1303 -91 875 529 \n",
       "Q 447 1150 447 2328 \n",
       "Q 447 3434 972 4092 \n",
       "Q 1497 4750 2381 4750 \n",
       "Q 2619 4750 2861 4703 \n",
       "Q 3103 4656 3366 4563 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-36\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 224.22358 147.907469 \n",
       "L 224.22358 9.307469 \n",
       "\" clip-path=\"url(#p0234fd3f20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#me1b5e33847\" x=\"224.22358\" y=\"147.907469\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- 80 -->\n",
       "      <g transform=\"translate(217.86108 162.505907) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \n",
       "Q 1584 2216 1326 1975 \n",
       "Q 1069 1734 1069 1313 \n",
       "Q 1069 891 1326 650 \n",
       "Q 1584 409 2034 409 \n",
       "Q 2484 409 2743 651 \n",
       "Q 3003 894 3003 1313 \n",
       "Q 3003 1734 2745 1975 \n",
       "Q 2488 2216 2034 2216 \n",
       "z\n",
       "M 1403 2484 \n",
       "Q 997 2584 770 2862 \n",
       "Q 544 3141 544 3541 \n",
       "Q 544 4100 942 4425 \n",
       "Q 1341 4750 2034 4750 \n",
       "Q 2731 4750 3128 4425 \n",
       "Q 3525 4100 3525 3541 \n",
       "Q 3525 3141 3298 2862 \n",
       "Q 3072 2584 2669 2484 \n",
       "Q 3125 2378 3379 2068 \n",
       "Q 3634 1759 3634 1313 \n",
       "Q 3634 634 3220 271 \n",
       "Q 2806 -91 2034 -91 \n",
       "Q 1263 -91 848 271 \n",
       "Q 434 634 434 1313 \n",
       "Q 434 1759 690 2068 \n",
       "Q 947 2378 1403 2484 \n",
       "z\n",
       "M 1172 3481 \n",
       "Q 1172 3119 1398 2916 \n",
       "Q 1625 2713 2034 2713 \n",
       "Q 2441 2713 2670 2916 \n",
       "Q 2900 3119 2900 3481 \n",
       "Q 2900 3844 2670 4047 \n",
       "Q 2441 4250 2034 4250 \n",
       "Q 1625 4250 1398 4047 \n",
       "Q 1172 3844 1172 3481 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-38\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 263.678125 147.907469 \n",
       "L 263.678125 9.307469 \n",
       "\" clip-path=\"url(#p0234fd3f20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#me1b5e33847\" x=\"263.678125\" y=\"147.907469\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- 100 -->\n",
       "      <g transform=\"translate(254.134375 162.505907) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_6\">\n",
       "     <!-- epoch -->\n",
       "     <g transform=\"translate(150.8 176.184032) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \n",
       "L 3597 1613 \n",
       "L 953 1613 \n",
       "Q 991 1019 1311 708 \n",
       "Q 1631 397 2203 397 \n",
       "Q 2534 397 2845 478 \n",
       "Q 3156 559 3463 722 \n",
       "L 3463 178 \n",
       "Q 3153 47 2828 -22 \n",
       "Q 2503 -91 2169 -91 \n",
       "Q 1331 -91 842 396 \n",
       "Q 353 884 353 1716 \n",
       "Q 353 2575 817 3079 \n",
       "Q 1281 3584 2069 3584 \n",
       "Q 2775 3584 3186 3129 \n",
       "Q 3597 2675 3597 1894 \n",
       "z\n",
       "M 3022 2063 \n",
       "Q 3016 2534 2758 2815 \n",
       "Q 2500 3097 2075 3097 \n",
       "Q 1594 3097 1305 2825 \n",
       "Q 1016 2553 972 2059 \n",
       "L 3022 2063 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \n",
       "L 1159 -1331 \n",
       "L 581 -1331 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2969 \n",
       "Q 1341 3281 1617 3432 \n",
       "Q 1894 3584 2278 3584 \n",
       "Q 2916 3584 3314 3078 \n",
       "Q 3713 2572 3713 1747 \n",
       "Q 3713 922 3314 415 \n",
       "Q 2916 -91 2278 -91 \n",
       "Q 1894 -91 1617 61 \n",
       "Q 1341 213 1159 525 \n",
       "z\n",
       "M 3116 1747 \n",
       "Q 3116 2381 2855 2742 \n",
       "Q 2594 3103 2138 3103 \n",
       "Q 1681 3103 1420 2742 \n",
       "Q 1159 2381 1159 1747 \n",
       "Q 1159 1113 1420 752 \n",
       "Q 1681 391 2138 391 \n",
       "Q 2594 391 2855 752 \n",
       "Q 3116 1113 3116 1747 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \n",
       "Q 1497 3097 1228 2736 \n",
       "Q 959 2375 959 1747 \n",
       "Q 959 1119 1226 758 \n",
       "Q 1494 397 1959 397 \n",
       "Q 2419 397 2687 759 \n",
       "Q 2956 1122 2956 1747 \n",
       "Q 2956 2369 2687 2733 \n",
       "Q 2419 3097 1959 3097 \n",
       "z\n",
       "M 1959 3584 \n",
       "Q 2709 3584 3137 3096 \n",
       "Q 3566 2609 3566 1747 \n",
       "Q 3566 888 3137 398 \n",
       "Q 2709 -91 1959 -91 \n",
       "Q 1206 -91 779 398 \n",
       "Q 353 888 353 1747 \n",
       "Q 353 2609 779 3096 \n",
       "Q 1206 3584 1959 3584 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \n",
       "L 3122 2828 \n",
       "Q 2878 2963 2633 3030 \n",
       "Q 2388 3097 2138 3097 \n",
       "Q 1578 3097 1268 2742 \n",
       "Q 959 2388 959 1747 \n",
       "Q 959 1106 1268 751 \n",
       "Q 1578 397 2138 397 \n",
       "Q 2388 397 2633 464 \n",
       "Q 2878 531 3122 666 \n",
       "L 3122 134 \n",
       "Q 2881 22 2623 -34 \n",
       "Q 2366 -91 2075 -91 \n",
       "Q 1284 -91 818 406 \n",
       "Q 353 903 353 1747 \n",
       "Q 353 2603 823 3093 \n",
       "Q 1294 3584 2113 3584 \n",
       "Q 2378 3584 2631 3529 \n",
       "Q 2884 3475 3122 3366 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \n",
       "L 3513 0 \n",
       "L 2938 0 \n",
       "L 2938 2094 \n",
       "Q 2938 2591 2744 2837 \n",
       "Q 2550 3084 2163 3084 \n",
       "Q 1697 3084 1428 2787 \n",
       "Q 1159 2491 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 4863 \n",
       "L 1159 4863 \n",
       "L 1159 2956 \n",
       "Q 1366 3272 1645 3428 \n",
       "Q 1925 3584 2291 3584 \n",
       "Q 2894 3584 3203 3211 \n",
       "Q 3513 2838 3513 2113 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-65\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-70\" x=\"61.523438\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"125\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-63\" x=\"186.181641\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-68\" x=\"241.162109\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 68.378125 93.708644 \n",
       "L 263.678125 93.708644 \n",
       "\" clip-path=\"url(#p0234fd3f20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <defs>\n",
       "       <path id=\"mc0a93a1234\" d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc0a93a1234\" x=\"68.378125\" y=\"93.708644\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- $\\mathdefault{10^{0}}$ -->\n",
       "      <g transform=\"translate(43.778125 97.507863) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(0 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.623047 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(128.203125 39.046875) scale(0.7)\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <defs>\n",
       "       <path id=\"m0b08ef31fe\" d=\"M 0 0 \n",
       "L -2 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0b08ef31fe\" x=\"68.378125\" y=\"145.892482\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0b08ef31fe\" x=\"68.378125\" y=\"132.166337\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- $\\mathdefault{6\\times10^{-1}}$ -->\n",
       "      <g transform=\"translate(20.878125 135.965556) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-d7\" d=\"M 4488 3438 \n",
       "L 3059 2003 \n",
       "L 4488 575 \n",
       "L 4116 197 \n",
       "L 2681 1631 \n",
       "L 1247 197 \n",
       "L 878 575 \n",
       "L 2303 2003 \n",
       "L 878 3438 \n",
       "L 1247 3816 \n",
       "L 2681 2381 \n",
       "L 4116 3816 \n",
       "L 4488 3438 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \n",
       "L 4684 2272 \n",
       "L 4684 1741 \n",
       "L 678 1741 \n",
       "L 678 2272 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-36\" transform=\"translate(0 0.684375)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-d7\" transform=\"translate(83.105469 0.684375)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(186.376953 0.684375)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(250 0.684375)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(314.580078 38.965625) scale(0.7)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(373.232422 38.965625) scale(0.7)\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0b08ef31fe\" x=\"68.378125\" y=\"120.561047\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0b08ef31fe\" x=\"68.378125\" y=\"110.508088\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0b08ef31fe\" x=\"68.378125\" y=\"101.640749\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0b08ef31fe\" x=\"68.378125\" y=\"41.524807\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- $\\mathdefault{2\\times10^{0}}$ -->\n",
       "      <g transform=\"translate(26.778125 45.324026) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(0 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-d7\" transform=\"translate(83.105469 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(186.376953 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(250 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(314.580078 39.046875) scale(0.7)\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0b08ef31fe\" x=\"68.378125\" y=\"10.999219\" style=\"stroke: #000000; stroke-width: 0.6\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- $\\mathdefault{3\\times10^{0}}$ -->\n",
       "      <g transform=\"translate(26.778125 14.798437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \n",
       "Q 3050 2419 3304 2112 \n",
       "Q 3559 1806 3559 1356 \n",
       "Q 3559 666 3084 287 \n",
       "Q 2609 -91 1734 -91 \n",
       "Q 1441 -91 1130 -33 \n",
       "Q 819 25 488 141 \n",
       "L 488 750 \n",
       "Q 750 597 1062 519 \n",
       "Q 1375 441 1716 441 \n",
       "Q 2309 441 2620 675 \n",
       "Q 2931 909 2931 1356 \n",
       "Q 2931 1769 2642 2001 \n",
       "Q 2353 2234 1838 2234 \n",
       "L 1294 2234 \n",
       "L 1294 2753 \n",
       "L 1863 2753 \n",
       "Q 2328 2753 2575 2939 \n",
       "Q 2822 3125 2822 3475 \n",
       "Q 2822 3834 2567 4026 \n",
       "Q 2313 4219 1838 4219 \n",
       "Q 1578 4219 1281 4162 \n",
       "Q 984 4106 628 3988 \n",
       "L 628 4550 \n",
       "Q 988 4650 1302 4700 \n",
       "Q 1616 4750 1894 4750 \n",
       "Q 2613 4750 3031 4423 \n",
       "Q 3450 4097 3450 3541 \n",
       "Q 3450 3153 3228 2886 \n",
       "Q 3006 2619 2597 2516 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(0 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-d7\" transform=\"translate(83.105469 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(186.376953 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(250 0.765625)\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(314.580078 39.046875) scale(0.7)\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_11\">\n",
       "     <!-- log rmse -->\n",
       "     <g transform=\"translate(14.798438 100.338719) rotate(-90) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \n",
       "L 1178 4863 \n",
       "L 1178 0 \n",
       "L 603 0 \n",
       "L 603 4863 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-67\" d=\"M 2906 1791 \n",
       "Q 2906 2416 2648 2759 \n",
       "Q 2391 3103 1925 3103 \n",
       "Q 1463 3103 1205 2759 \n",
       "Q 947 2416 947 1791 \n",
       "Q 947 1169 1205 825 \n",
       "Q 1463 481 1925 481 \n",
       "Q 2391 481 2648 825 \n",
       "Q 2906 1169 2906 1791 \n",
       "z\n",
       "M 3481 434 \n",
       "Q 3481 -459 3084 -895 \n",
       "Q 2688 -1331 1869 -1331 \n",
       "Q 1566 -1331 1297 -1286 \n",
       "Q 1028 -1241 775 -1147 \n",
       "L 775 -588 \n",
       "Q 1028 -725 1275 -790 \n",
       "Q 1522 -856 1778 -856 \n",
       "Q 2344 -856 2625 -561 \n",
       "Q 2906 -266 2906 331 \n",
       "L 2906 616 \n",
       "Q 2728 306 2450 153 \n",
       "Q 2172 0 1784 0 \n",
       "Q 1141 0 747 490 \n",
       "Q 353 981 353 1791 \n",
       "Q 353 2603 747 3093 \n",
       "Q 1141 3584 1784 3584 \n",
       "Q 2172 3584 2450 3431 \n",
       "Q 2728 3278 2906 2969 \n",
       "L 2906 3500 \n",
       "L 3481 3500 \n",
       "L 3481 434 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-20\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-72\" d=\"M 2631 2963 \n",
       "Q 2534 3019 2420 3045 \n",
       "Q 2306 3072 2169 3072 \n",
       "Q 1681 3072 1420 2755 \n",
       "Q 1159 2438 1159 1844 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2956 \n",
       "Q 1341 3275 1631 3429 \n",
       "Q 1922 3584 2338 3584 \n",
       "Q 2397 3584 2469 3576 \n",
       "Q 2541 3569 2628 3553 \n",
       "L 2631 2963 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6d\" d=\"M 3328 2828 \n",
       "Q 3544 3216 3844 3400 \n",
       "Q 4144 3584 4550 3584 \n",
       "Q 5097 3584 5394 3201 \n",
       "Q 5691 2819 5691 2113 \n",
       "L 5691 0 \n",
       "L 5113 0 \n",
       "L 5113 2094 \n",
       "Q 5113 2597 4934 2840 \n",
       "Q 4756 3084 4391 3084 \n",
       "Q 3944 3084 3684 2787 \n",
       "Q 3425 2491 3425 1978 \n",
       "L 3425 0 \n",
       "L 2847 0 \n",
       "L 2847 2094 \n",
       "Q 2847 2600 2669 2842 \n",
       "Q 2491 3084 2119 3084 \n",
       "Q 1678 3084 1418 2786 \n",
       "Q 1159 2488 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2956 \n",
       "Q 1356 3278 1631 3431 \n",
       "Q 1906 3584 2284 3584 \n",
       "Q 2666 3584 2933 3390 \n",
       "Q 3200 3197 3328 2828 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \n",
       "L 2834 2853 \n",
       "Q 2591 2978 2328 3040 \n",
       "Q 2066 3103 1784 3103 \n",
       "Q 1356 3103 1142 2972 \n",
       "Q 928 2841 928 2578 \n",
       "Q 928 2378 1081 2264 \n",
       "Q 1234 2150 1697 2047 \n",
       "L 1894 2003 \n",
       "Q 2506 1872 2764 1633 \n",
       "Q 3022 1394 3022 966 \n",
       "Q 3022 478 2636 193 \n",
       "Q 2250 -91 1575 -91 \n",
       "Q 1294 -91 989 -36 \n",
       "Q 684 19 347 128 \n",
       "L 347 722 \n",
       "Q 666 556 975 473 \n",
       "Q 1284 391 1588 391 \n",
       "Q 1994 391 2212 530 \n",
       "Q 2431 669 2431 922 \n",
       "Q 2431 1156 2273 1281 \n",
       "Q 2116 1406 1581 1522 \n",
       "L 1381 1569 \n",
       "Q 847 1681 609 1914 \n",
       "Q 372 2147 372 2553 \n",
       "Q 372 3047 722 3315 \n",
       "Q 1072 3584 1716 3584 \n",
       "Q 2034 3584 2315 3537 \n",
       "Q 2597 3491 2834 3397 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-6c\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"27.783203\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-67\" x=\"88.964844\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-20\" x=\"152.441406\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-72\" x=\"184.228516\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6d\" x=\"223.591797\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-73\" x=\"321.003906\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-65\" x=\"373.103516\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_20\">\n",
       "    <path d=\"M 68.378125 17.508623 \n",
       "L 70.350852 54.343277 \n",
       "L 72.32358 84.639378 \n",
       "L 74.296307 84.671297 \n",
       "L 76.269034 15.607469 \n",
       "L 78.241761 36.4627 \n",
       "L 80.214489 86.719572 \n",
       "L 82.187216 88.134554 \n",
       "L 84.159943 110.207854 \n",
       "L 86.13267 93.830507 \n",
       "L 88.105398 104.072014 \n",
       "L 90.078125 121.48003 \n",
       "L 92.050852 131.522445 \n",
       "L 94.02358 115.145079 \n",
       "L 95.996307 114.723792 \n",
       "L 97.969034 115.427042 \n",
       "L 99.941761 121.509828 \n",
       "L 101.914489 123.329956 \n",
       "L 103.887216 141.607469 \n",
       "L 105.859943 121.571895 \n",
       "L 107.83267 113.463895 \n",
       "L 109.805398 121.57955 \n",
       "L 111.778125 42.862966 \n",
       "L 113.750852 137.665792 \n",
       "L 115.72358 89.375906 \n",
       "L 117.696307 96.172386 \n",
       "L 119.669034 115.212275 \n",
       "L 121.641761 114.41952 \n",
       "L 123.614489 115.182444 \n",
       "L 125.587216 115.01354 \n",
       "L 127.559943 115.184032 \n",
       "L 129.53267 115.102872 \n",
       "L 131.505398 115.536024 \n",
       "L 133.478125 114.702036 \n",
       "L 135.450852 111.750967 \n",
       "L 137.42358 115.312939 \n",
       "L 139.396307 115.467448 \n",
       "L 141.369034 115.557284 \n",
       "L 143.341761 114.893991 \n",
       "L 145.314489 114.090484 \n",
       "L 147.287216 115.641127 \n",
       "L 149.259943 113.757768 \n",
       "L 151.23267 114.973324 \n",
       "L 153.205398 115.781143 \n",
       "L 155.178125 115.787064 \n",
       "L 157.150852 115.429581 \n",
       "L 159.12358 115.670023 \n",
       "L 161.096307 115.534812 \n",
       "L 163.069034 115.74191 \n",
       "L 165.041761 115.854661 \n",
       "L 167.014489 115.810821 \n",
       "L 168.987216 115.468478 \n",
       "L 170.959943 115.719046 \n",
       "L 172.93267 115.648292 \n",
       "L 174.905398 115.519697 \n",
       "L 176.878125 114.488531 \n",
       "L 178.850852 109.108077 \n",
       "L 180.82358 115.319761 \n",
       "L 182.796307 114.831415 \n",
       "L 184.769034 114.945063 \n",
       "L 186.741761 115.081084 \n",
       "L 188.714489 115.603858 \n",
       "L 190.687216 115.744045 \n",
       "L 192.659943 115.166874 \n",
       "L 194.63267 115.577027 \n",
       "L 196.605398 115.826031 \n",
       "L 198.578125 115.626146 \n",
       "L 200.550852 115.603023 \n",
       "L 202.52358 115.813933 \n",
       "L 204.496307 115.121846 \n",
       "L 206.469034 115.664406 \n",
       "L 208.441761 110.893695 \n",
       "L 210.414489 115.479437 \n",
       "L 212.387216 110.916059 \n",
       "L 214.359943 105.591357 \n",
       "L 216.33267 115.277726 \n",
       "L 218.305398 115.658316 \n",
       "L 220.278125 123.397185 \n",
       "L 222.250852 138.108745 \n",
       "L 224.22358 71.064207 \n",
       "L 226.196307 111.672928 \n",
       "L 228.169034 117.753425 \n",
       "L 230.141761 118.534795 \n",
       "L 232.114489 119.94589 \n",
       "L 234.087216 120.736002 \n",
       "L 236.059943 112.581612 \n",
       "L 238.03267 116.231189 \n",
       "L 240.005398 121.741956 \n",
       "L 241.978125 121.570758 \n",
       "L 243.950852 123.023572 \n",
       "L 245.92358 122.561081 \n",
       "L 247.896307 123.774527 \n",
       "L 249.869034 123.916617 \n",
       "L 251.841761 123.989739 \n",
       "L 253.814489 124.670871 \n",
       "L 255.787216 124.661312 \n",
       "L 257.759943 124.084324 \n",
       "L 259.73267 125.112102 \n",
       "L 261.705398 125.854758 \n",
       "L 263.678125 126.132157 \n",
       "\" clip-path=\"url(#p0234fd3f20)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 68.378125 147.907469 \n",
       "L 68.378125 9.307469 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 263.678125 147.907469 \n",
       "L 263.678125 9.307469 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 68.378125 147.907469 \n",
       "L 263.678125 147.907469 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 68.378125 9.307469 \n",
       "L 263.678125 9.307469 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p0234fd3f20\">\n",
       "   <rect x=\"68.378125\" y=\"9.307469\" width=\"195.3\" height=\"138.6\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 350x250 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "def train_and_pred(train_features,test_features,train_labels,test_data,\n",
    "                   num_epochs,lr,weight_decay,batch_size\n",
    "                   ):\n",
    "    net=get_net()\n",
    "    train_ls,_=train(net,train_features,train_labels,None,None,num_epochs,lr,weight_decay,batch_size)\n",
    "    d2l.plot(np.arange(1,num_epochs+1),[train_ls],xlabel='epoch',ylabel='log rmse',xlim=[1,num_epochs],yscale='log'\n",
    "             )\n",
    "    print(f'训练log rmse:{float(train_ls[-1])}')\n",
    "    #预测\n",
    "    preds=net(test_features).detach().numpy()\n",
    "    \"\"\"将preds调整为包含一行的二维数组，取第一个行（拿出所有数），变成(xxx,)格式的一维数组\"\"\"\n",
    "    test_data['SalePrice']=pd.Series(preds.reshape(1,-1)[0])\n",
    "    # print(test_data['SalePrice'].shape)\n",
    "    submission=pd.concat([test_data['Id'],test_data['SalePrice']],axis=1)\n",
    "    submission.to_csv('submission.csv')    \n",
    "\n",
    "train_and_pred(train_features,test_features,train_labels,test_data,num_epochs,lr,weight_decay,batch_size)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "DL_pytorch",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
